package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 王圆豪
 * Date: 2024-05-25
 * Time: 19:52
 */
public class AddBook implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("新增图书....");
        Scanner sc = new Scanner(System.in);
        Book book = new Book();
        System.out.println("书名：");
        String name = sc.nextLine();
        book.setName(name);
        System.out.println("作者：");
        String author = sc.nextLine();
        book.setAuthor(author);
        System.out.println("类型：");
        String type = sc.nextLine();
        book.setType(type);
        System.out.println("价格：");
        double price = sc.nextDouble();
        book.setPrice(price);
        bookList.setBooks(book, bookList.getEffnum());
        bookList.setEffnum(bookList.getEffnum() + 1);
        //sc.close();
    }
}
